package com.tech.java;

public enum SubscribeSourceEnum {

    subscribe("普通关注"),
    couponEc("领取体验券"),
    wifi("商户wifi"),
    limitbuy("秒杀-加购物车"),
    pintuan("拼团"),
    product("普通商品"),
    order("查看订单"),
    scanning("扫描关注"),
    shareCoupon("支付分享券"),
    vote("参与投票"),
    offineComment("线下支付去评价"),
    offineGetFollowCoupon("收银台支付结果页面点击领取新粉关注券"),
    offineQueryMemberScore("收银台支付结果页查询会员积分");


    private SubscribeSourceEnum(String desc) {
        this.desc = desc;
    }

    private final String desc;

    public String getDesc() {
        return desc;
    }

    /**
     * 判断一个字符串是否属于枚举中的一种
     * @param key
     * @return
     */
    public static boolean isContain(String key) {
        boolean include = false;

        for (SubscribeSourceEnum e : SubscribeSourceEnum.values()) {
            if (key.equals(e.name())) {
                include = true;
                break;
            }
        }
        return include;
    }

    public static void main(String[] args) {
        String string = "aa";
        string.contains("aa");
        System.out.println(isContain(null));
    }
}
